package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-02
 * Time: 10:49
 */
public class Test {
    public static void func1(Food food) {
        food.eat();
    }
    public static void main(String[] args) {
        Food[] foods = {new Rice(),new Dumplings(),new Rice()};
        for (int i = 0; i < foods.length; i++) {
            func1(foods[i]);
        }
    }
}
